Integrand size = 27, antiderivative size = 171 \[ \int \left (c (d \tan (e+f x))^p\right )^n (a+b \tan (e+f x))^2 \, dx=\frac {b^2 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {\left (a^2-b^2\right ) \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (1+n p),\frac {1}{2} (3+n p),-\tan ^2(e+f x)\right ) \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {2 a b \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (2+n p),\frac {1}{2} (4+n p),-\tan ^2(e+f x)\right ) \tan ^2(e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (2+n p)} \]
[Out]
Time = 0.31 (sec) , antiderivative size = 171, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.148, Rules used = {1970, 1816, 822, 371} \[ \int \left (c (d \tan (e+f x))^p\right )^n (a+b \tan (e+f x))^2 \, dx=\frac {\left (a^2-b^2\right ) \tan (e+f x) \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (n p+1),\frac {1}{2} (n p+3),-\tan ^2(e+f x)\right ) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+1)}+\frac {2 a b \tan ^2(e+f x) \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (n p+2),\frac {1}{2} (n p+4),-\tan ^2(e+f x)\right ) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+2)}+\frac {b^2 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (n p+1)} \]
[In]
[Out]
Rule 371
Rule 822
Rule 1816
Rule 1970
Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {\left (c (d x)^p\right )^n (a+b x)^2}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {\left (\tan ^{-n p}(e+f x) \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \frac {x^{n p} (a+b x)^2}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {\left (\tan ^{-n p}(e+f x) \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \left (b^2 x^{n p}+\frac {x^{n p} \left (a^2-b^2+2 a b x\right )}{1+x^2}\right ) \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {b^2 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {\left (\tan ^{-n p}(e+f x) \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \frac {x^{n p} \left (a^2-b^2+2 a b x\right )}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {b^2 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {\left (2 a b \tan ^{-n p}(e+f x) \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \frac {x^{1+n p}}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}+\frac {\left (\left (a^2-b^2\right ) \tan ^{-n p}(e+f x) \left (c (d \tan (e+f x))^p\right )^n\right ) \text {Subst}\left (\int \frac {x^{n p}}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {b^2 \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {\left (a^2-b^2\right ) \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (1+n p),\frac {1}{2} (3+n p),-\tan ^2(e+f x)\right ) \tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (1+n p)}+\frac {2 a b \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (2+n p),\frac {1}{2} (4+n p),-\tan ^2(e+f x)\right ) \tan ^2(e+f x) \left (c (d \tan (e+f x))^p\right )^n}{f (2+n p)} \\ \end{align*}
Time = 0.64 (sec) , antiderivative size = 136, normalized size of antiderivative = 0.80 \[ \int \left (c (d \tan (e+f x))^p\right )^n (a+b \tan (e+f x))^2 \, dx=\frac {\tan (e+f x) \left (c (d \tan (e+f x))^p\right )^n \left (\left (a^2-b^2\right ) (2+n p) \operatorname {Hypergeometric2F1}\left (1,\frac {1}{2} (1+n p),\frac {1}{2} (3+n p),-\tan ^2(e+f x)\right )+b \left (b (2+n p)+2 a (1+n p) \operatorname {Hypergeometric2F1}\left (1,1+\frac {n p}{2},2+\frac {n p}{2},-\tan ^2(e+f x)\right ) \tan (e+f x)\right )\right )}{f (1+n p) (2+n p)} \]
[In]
[Out]
\[\int \left (c \left (d \tan \left (f x +e \right )\right )^{p}\right )^{n} \left (a +b \tan \left (f x +e \right )\right )^{2}d x\]
[In]
[Out]
\[ \int \left (c (d \tan (e+f x))^p\right )^n (a+b \tan (e+f x))^2 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{2} \left (\left (d \tan \left (f x + e\right )\right )^{p} c\right )^{n} \,d x } \]
[In]
[Out]
\[ \int \left (c (d \tan (e+f x))^p\right )^n (a+b \tan (e+f x))^2 \, dx=\int \left (c \left (d \tan {\left (e + f x \right )}\right )^{p}\right )^{n} \left (a + b \tan {\left (e + f x \right )}\right )^{2}\, dx \]
[In]
[Out]
\[ \int \left (c (d \tan (e+f x))^p\right )^n (a+b \tan (e+f x))^2 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{2} \left (\left (d \tan \left (f x + e\right )\right )^{p} c\right )^{n} \,d x } \]
[In]
[Out]
\[ \int \left (c (d \tan (e+f x))^p\right )^n (a+b \tan (e+f x))^2 \, dx=\int { {\left (b \tan \left (f x + e\right ) + a\right )}^{2} \left (\left (d \tan \left (f x + e\right )\right )^{p} c\right )^{n} \,d x } \]
[In]
[Out]
Timed out. \[ \int \left (c (d \tan (e+f x))^p\right )^n (a+b \tan (e+f x))^2 \, dx=\int {\left (c\,{\left (d\,\mathrm {tan}\left (e+f\,x\right )\right )}^p\right )}^n\,{\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}^2 \,d x \]
[In]
[Out]